package com.ruoyi.cms.domain.dto;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Pattern;

import com.ruoyi.cms.domain.CmsSite;
/**
 * 站点信息对象 cms_site
 *
 * @author ruoyi
 * @date 2021-07-28
 */
@ApiModel("站点信息对象")
@Data
@Accessors(chain = true)
public class CmsSiteDTO  {

    /** 站点ID - bigint(20) */
    @ApiModelProperty(value = "站点ID（主键.新增时为空,修改时必填!）")
    private Long siteId;

    /** 名称 - varchar(50) */
    @ApiModelProperty(value = "名称", required = true)
    @NotEmpty(message = "名称必填!")
    @Length(max = 50, message = "名称限制最多50个字符!")
    private String siteName;

    /** 域名 - varchar(50) */
    @ApiModelProperty(value = "域名", required = true)
    @NotEmpty(message = "域名必填!")
    @Length(max = 50, message = "域名限制最多50个字符!")
    private String siteDomain;

    /** 状态（0正常 1停用） - char(1) */
    @ApiModelProperty(value = "状态（0正常 1停用）", required = false)
    @Pattern(regexp = "^$|^(0|1)$", message = "状态数据格式错误!")
    private String status;

    /** 删除标志（0代表存在 2代表删除） - char(1) */
    @ApiModelProperty(value = "删除标志（0代表存在 2代表删除）", required = false)
    @Pattern(regexp = "^$|^(0|2)$", message = "删除标志数据格式错误!")
    private String delFlag;

    /** 创建人 - varchar(64) */
    @ApiModelProperty(value = "创建人", required = false)
    @Length(max = 64, message = "创建人限制最多64个字符!")
    private String createBy;

    /** 创建时间 - datetime */
    @ApiModelProperty(value = "创建时间", required = false)
    private Date createTime;

    /** 修改人 - varchar(64) */
    @ApiModelProperty(value = "修改人", required = false)
    @Length(max = 64, message = "修改人限制最多64个字符!")
    private String updateBy;

    /** 修改时间 - datetime */
    @ApiModelProperty(value = "修改时间", required = false)
    private Date updateTime;

    /** 备注 - varchar(500) */
    @ApiModelProperty(value = "备注", required = false)
    @Length(max = 500, message = "备注限制最多500个字符!")
    private String remark;

    @JsonIgnore
    @ApiModelProperty(value = "额外参数", required = false, hidden = true)
    Map<String, Object> params = new HashMap<>();

    /** 构造方法 */
    public CmsSiteDTO() {}

    /** 构造方法 com.ruoyi.cms.domain.CmsSite  */
    public CmsSiteDTO(CmsSite data) {
        this.setSiteId(data.getSiteId());
        this.setSiteName(data.getSiteName());
        this.setSiteDomain(data.getSiteDomain());
        this.setStatus(data.getStatus());
        this.setDelFlag(data.getDelFlag());
        this.setCreateBy(data.getCreateBy());
        this.setCreateTime(data.getCreateTime());
        this.setUpdateBy(data.getUpdateBy());
        this.setUpdateTime(data.getUpdateTime());
        this.setRemark(data.getRemark());
    }

    /**
    * 转换为 com.ruoyi.cms.domain.CmsSite
    */
    public CmsSite as() {
        CmsSite data = new CmsSite();
        data.setSiteId(this.getSiteId());
        data.setSiteName(this.getSiteName());
        data.setSiteDomain(this.getSiteDomain());
        data.setStatus(this.getStatus());
        data.setDelFlag(this.getDelFlag());
        data.setCreateBy(this.getCreateBy());
        data.setCreateTime(this.getCreateTime());
        data.setUpdateBy(this.getUpdateBy());
        data.setUpdateTime(this.getUpdateTime());
        data.setRemark(this.getRemark());
        return data;
    }


}
